use strict;
use warnings;

my $data_file = "shspanningtreedetail.txt";
print "$data_file \n";

   # Open the file for reading.
open (DATA, "$data_file") or die "can't open $data_file $!";
my @array_of_data = <DATA>;

my $vlan;
my $rootmac;

        foreach ($vlan, $rootmac) (@array_of_data)
        {
                # Start an if statement, and extract variables

        if ($vlan =~ / VLAN\d\d\d\d\sis\sexecuting/)
        if ($rootmac =~ /  Bridge Identifier has priority \d\d\d\d\d/)
        {
       print "Step1: $vlan";
        print "Step2: $rootmac";
                } # End the if condition here.
        } # End the foreach loop here.

 }


close (DATA);
